<?php
/**
 * Created by PhpStorm.
 * User: Guangpeng Chen
 * Date: 15-4-3
 * Time: 上午11:10
 */
header('Content-type: application/x-javascript');
define('ROOT_PATH','/var/www/html/new/d/');
define('FX_PATH', ROOT_PATH.'class/');

include '/var/www/html/new/com.inc.php';
include ROOT_PATH . 'common/func.inc.php';
include FX_PATH . 'Member.php';
include FX_PATH . 'SoapInit.class.php';
include FX_PATH . 'AccessRecord.php';
include 'Handler.class.php';
//include '../common/Db.class.php';
echo $_POST['refund_status'];
$action = $_REQUEST['action'];
$soap   = SoapInit::GetSoapInside();
$memberId = $_SESSION['memberID'];
if (!$memberId){
    exit('{"outcome":-1,"msg":"未登录或登录超时"}');
}
$obj = new \PFT\Withdraw\Handler(new Member($soap, $memberId), $soap, $memberId );
switch($action) {
    case 'apply':
        //申请提现
        echo json_encode( $obj->Apply(intval($_POST['money'])) );
        break;
    case 'refund':
        if ($_SESSION['sdtype']!=9) {
            exit('{"outcome":-1,"msg":"您无权限操作！"}');
        }
        //审批提现
        $log_id = intval($_POST['id']);
        $status = intval($_POST['refund_status']);
        echo json_encode($obj->Refund($log_id, $status));
        break;
}